package edu.rjh.picturebackand.service;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.qcloud.cos.exception.CosClientException;
import edu.rjh.picturebackand.moudle.dto.picture.*;
import edu.rjh.picturebackand.moudle.entity.Picture;
import edu.rjh.picturebackand.moudle.entity.User;
import edu.rjh.picturebackand.moudle.vo.PictureVO;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 李鱼皮
 * @description 针对表【picture(图片)】的数据库操作Service
 * @createDate 2024-12-11 20:45:51
 */
public interface PictureService extends IService<Picture> {

/**
  * 校验图片
  *
  * @param picture
  */
 void validPicture(Picture picture);

 /**
  * 上传图片
  *
  * @param inputSource          文件输入源
  * @param pictureUploadRequest
  * @param loginUser
  * @return
  */
 PictureVO uploadPicture(Object inputSource,
                         PictureUploadRequest pictureUploadRequest,
                         User loginUser);
 /**
  * 获取图片包装类（单条）
  *
  * @param picture
  * @param request
  * @return
  */
 PictureVO getPictureVO(Picture picture, HttpServletRequest request);

 /**
  * 获取图片包装类（分页）
  *
  * @param picturePage
  * @param request
  * @return
  */
 Page<PictureVO> getPictureVOPage(Page<Picture> picturePage, HttpServletRequest request);

 /**
  * 获取查询条件
  *
  * @param pictureQueryRequest
  * @return
  */
 QueryWrapper<Picture> getQueryWrapper(PictureQueryRequest pictureQueryRequest);


 /**
  * 图片审核
  *
  * @param pictureReviewRequest
  * @param loginUser
  */
 void doPictureReview(PictureReviewRequest pictureReviewRequest, User loginUser);


 /**
  * 填充审核参数
  *
  * @param picture
  * @param loginUser
  */
 void fillReviewParams(Picture picture, User loginUser);

 /**
  * 批量抓取和创建图片
  *
  * @param pictureUploadByBatchRequest
  * @param loginUser
  * @return 成功创建的图片数
  */
 Integer uploadPictureByBatch(
         PictureUploadByBatchRequest pictureUploadByBatchRequest,
         User loginUser
 );

 /**
  * 删除对象
  *
  * @param picture 图片对象
  */
 void clearPictureFile(Picture picture);

 /**
  * 清除图片权限
  *
  * @param loginUser
  * @param picture
  */
 void checkPictureAuth(User loginUser, Picture picture);

 /**
  * 删除图片
  *
  * @param pictureId
  * @param loginUser
  */
 void deletePicture(long pictureId, User loginUser);

 /**
  * 编辑图片
  *
  * @param pictureEditRequest
  * @param loginUser
  */
 void editPicture(PictureEditRequest pictureEditRequest, User loginUser);

}
